package com.ruoyi.web.controller.category.api;

import com.ruoyi.category.service.ICategoryService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author : 张怀秋
 **/
@Api(tags = "前台:项目分类")
@Slf4j
@RestController
@RequestMapping("/api/category")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CategoryApiController extends BaseController {

    private final ICategoryService categoryService;

    @ApiOperation(value = "根据名称查询分类", notes = "返回的值是该分类下所有的子分类")
    @GetMapping("/findCategoryChildListByName/{name}")
    public AjaxResult findCategoryChildListByName(@ApiParam("参数:分类名称") @PathVariable("name") String categoryName) {
        return success(this.categoryService.findCategoryChildListByName(categoryName));
    }

}
